import develiver.RestfulMessageDeliverer;
import resources.StatusResource;
import resources.TaskResource;
import resources.TokenResource;
import resources.WarningResource;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * describe:
 *
 * @author helloworldyu
 * @data 2017/12/11
 */
public class Main {
	public static void main(String[] args) {
		CustomCoapServer customCoapServer = new CustomCoapServer(
				5683,
				new RestfulMessageDeliverer(),
				new TokenResource(),
				new StatusResource(),
				new WarningResource(),
				new TaskResource() );

		customCoapServer.start();

		DataInputStream inputStream = new DataInputStream(System.in);

		byte c = '\0';
		do {
			try {
				System.out.println("按 q 键退出服务");
				c = inputStream.readByte();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} while ( c != 'q' );

		System.out.println("退出服务");




		customCoapServer.stop();
	}
}